package com.qs.cwams.util;

import java.util.Arrays;
import java.util.Optional;

/**
 * @author suncheng
 */
public enum AtteResult {
    add("加班", false),
    late("迟到", true),
    leave("早退", true),
    forgotA("上班忘打卡", true),
    forgotP("下班忘打卡", true),
    none("无考勤", true),
    ok("正常", false);

    private final String result;

    private final boolean except;

    AtteResult(String result, boolean except) {
        this.result = result;
        this.except = except;
    }

    public String getResult() {
        return result;
    }

    public boolean getExcept() {
        return except;
    }

    public static boolean containExcept(String result) {
        Optional<AtteResult> optional =  Arrays.stream(AtteResult.values()).filter(item -> result.contains(item.result) && item.except).findAny();
        return optional.isPresent();
    }
}
